<?php
$sqlquery = <<< EOT
DROP TABLE IF EXISTS `prefix_poster`;
CREATE TABLE `prefix_poster` (
`id`  smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT ,
`siteid`  smallint(5) UNSIGNED NOT NULL DEFAULT 0 COMMENT '站点id' ,
`name`  varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '广告名称' ,
`spaceid`  smallint(5) UNSIGNED NOT NULL DEFAULT 0 COMMENT '广告类型id' ,
`type`  varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '广告类型' ,
`setting`  text CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
`startdate`  int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '开始时间' ,
`enddate`  int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '结束时间' ,
`addtime`  int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '新增时间' ,
`hits`  mediumint(8) UNSIGNED NOT NULL DEFAULT 0 ,
`clicks`  smallint(5) UNSIGNED NOT NULL DEFAULT 0 ,
`listorder`  tinyint(3) UNSIGNED NOT NULL DEFAULT 0 ,
`disabled`  tinyint(1) UNSIGNED NOT NULL DEFAULT 0 ,
PRIMARY KEY (`id`),
INDEX `spaceid` (`spaceid`, `siteid`, `disabled`, `listorder`) USING BTREE 
)
TYPE=MyISAM;

DROP TABLE IF EXISTS `prefix_poster_space`;
CREATE TABLE `prefix_poster_space` (
`spaceid`  smallint(5) UNSIGNED NOT NULL AUTO_INCREMENT ,
`siteid`  smallint(5) UNSIGNED NOT NULL DEFAULT 0 COMMENT '站点id' ,
`name`  char(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '广告版位名称' ,
`type`  char(30) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '版位类型' ,
`path`  char(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '地址' ,
`width`  smallint(4) UNSIGNED NOT NULL DEFAULT 0 COMMENT '宽度' ,
`height`  smallint(4) UNSIGNED NOT NULL DEFAULT 0 COMMENT '高度' ,
`setting`  char(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
`description`  char(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '描述' ,
`items`  tinyint(3) UNSIGNED NOT NULL DEFAULT 0 ,
`disabled`  tinyint(1) UNSIGNED NOT NULL DEFAULT 0 ,
PRIMARY KEY (`spaceid`),
INDEX `disabled` (`disabled`, `siteid`) USING BTREE 
)
TYPE=MyISAM;

EOT;
$menuid = D('Node')->add(array('parentid'=>72,'name'=>'广告','m'=>'Poster','c'=>'PosterSpace','a'=>'init'));
	D('Node')->add(array('parentid'=>$menuid,'name'=>'预览','m'=>'Poster','c'=>'PosterSpace','a'=>'public_preview','display'=>'0'));
	D('Node')->add(array('parentid'=>$menuid,'name'=>'广告列表','m'=>'Poster','c'=>'Poster','a'=>'init','display'=>'0'));
	D('Node')->add(array('parentid'=>$menuid,'name'=>'添加版位','m'=>'Poster','c'=>'PosterSpace','a'=>'add'));
		D('Node')->add(array('parentid'=>$menuid,'name'=>'广告修改','m'=>'Poster','c'=>'Poster','a'=>'edit','display'=>'0'));
		D('Node')->add(array('parentid'=>$menuid,'name'=>'广告统计','m'=>'Poster','c'=>'Poster','a'=>'stat','display'=>'0'));
	D('Node')->add(array('parentid'=>$menuid,'name'=>'修改','m'=>'Poster','c'=>'PosterSpace','a'=>'edit','display'=>'0'));
	D('Node')->add(array('parentid'=>$menuid,'name'=>'删除','m'=>'Poster','c'=>'PosterSpace','a'=>'delete','display'=>'0'));
	D('Node')->add(array('parentid'=>$menuid,'name'=>'添加广告','m'=>'Poster','c'=>'Poster','a'=>'add','display'=>'0'));
	
$_poster_template = D('Node')->add(array('parentid'=>$menuid,'name'=>'广告模板配置','m'=>'Poster','c'=>'PosterSpace','a'=>'poster_template'));
$_creat_js = D('Node')->add(array('parentid'=>$menuid,'name'=>'重新生成js','m'=>'Poster','c'=>'PosterSpace','a'=>'creat_js'));
?>